package com.glc.gao.gavin.rxjavademo.operator;

import android.util.Log;
import android.view.View;

import com.glc.gao.gavin.rxjavademo.R;

import io.reactivex.Flowable;
import io.reactivex.Observable;
import io.reactivex.annotations.NonNull;
import io.reactivex.functions.Consumer;

public class TakeActivity extends BaseActivity {
    @Override
    public int getDescribeText() {
        return R.string.describe_take;
    }

    @Override
    protected int getContextView() {
        return R.layout.activity_take;
    }

    public void executeTake(View view) {
        Observable.just(1, 2, 3, 4, 5)
                .take(2)
                .subscribe(new Consumer<Integer>() {
                    @Override
                    public void accept(@NonNull Integer integer) throws Exception {
                        print("accept: take : " + integer + "\n");
                    }
                });
    }
}
